#ifndef TCPCLIENT_H
#define TCPCLIENT_H

#include <QWidget>
#include <QFile>
#include <QTcpSocket>
#include "friend.h"

QT_BEGIN_NAMESPACE
namespace Ui {
class TcpClient;
}
QT_END_NAMESPACE

class TcpClient : public QWidget
{
    Q_OBJECT

public:
    TcpClient(QWidget *parent = nullptr);
    ~TcpClient();

    void loadConfig();

public slots:
    void show_connect();

private slots:
    // void on_send_pushButton_clicked();

    void on_login_btn_clicked();

    void on_register_btn_clicked();

    void on_logout_btn_clicked();

public:
    static TcpClient& getInstance();

    QTcpSocket& getTcpSocket();

    QString get_login_name();

    QString get_current_dir();

    void set_current_dir(const QString& path);

private:
    Ui::TcpClient *ui;
    QString m_ip;
    quint16 m_port;

    QTcpSocket m_tcpsocket;

    QString m_login_name;

    QString m_current_dir;

    QFile m_recv_file;

};
#endif // TCPCLIENT_H
